<template>
  <div class="text-sm">
    <div class="flex items-center justify-between border p-1.5 bg-[#f2f2f2]">
      <span class="font-bold">患者信息</span>
      <span
        class="bg-[#189f93] text-zinc-100 p-[6px] text-sm"
        @click="handleBack"
        >返回</span
      >
    </div>
    <m-row
      :list="[
        { name: '姓名', value: checkLisDetail?.fhz_name },
        { name: '性别', value: checkLisDetail?.fsex },
        { name: '编号', value: checkLisDetail?.fhz_id }
      ]"
    ></m-row>
    <m-row
      :list="[
        { name: '年龄', value: checkLisDetail?.fage },
        { name: '电话', value: checkLisDetail?.fhz_tel }
      ]"
    ></m-row>
    <div class="flex items-center border-b p-2 bg-[#f2f2f2]">
      <span class="font-bold">检查信息</span>
    </div>
    <m-row
      :list="[
        { name: '检验仪器', value: checkLisDetail?.fjy_instr },
        { name: '样本日期', value: checkLisDetail?.fjy_date },
        { name: '样本号', value: checkLisDetail?.fjy_yb_code }
      ]"
    ></m-row>
    <m-row
      :list="[
        { name: '审核医师', value: checkLisDetail?.fcheckerName },
        { name: '样本类型', value: checkLisDetail?.fybtypeName },
        { name: '审核时间', value: checkLisDetail?.fcheck_time }
      ]"
    ></m-row>
    <m-row
      :list="[
        { name: '申请科室', value: checkLisDetail?.fdeptName },
        { name: '申请医生', value: checkLisDetail?.fdoctorName },
        { name: '床位号', value: checkLisDetail?.fhz_bed }
      ]"
    ></m-row>
    <div class="text-[#02094f] font-bold p-1">检验结果:</div>
    <div v-if="checkLisDetail?.samJYResults">
      <easy-data-table
        :headers="headers"
        :items="checkLisDetail?.samJYResults"
        show-index
      ></easy-data-table>
    </div>
  </div>
</template>

<script setup lang="ts">

import { useRoute, useRouter } from 'vue-router'
import type { Header, Item } from 'vue3-easy-data-table'
import checkLisServer from '../service/index'
import { onBeforeMount, onMounted , ref} from 'vue'
const reset = ref(false)

const router = useRouter()

const { checkLisDetail, findCheckLisDetail } = checkLisServer
const handleBack = () => {
  router.back()
}
findCheckLisDetail()
const headers: Header[] = [
  { text: '检验项目', value: 'fitem_code' },
  { text: '项目名称', value: 'fitem_name' },
  { text: '检验结果', value: 'fvalue' },
  { text: '单位', value: 'fitem_unit' },
  { text: '参考范围', value: 'fitem_ref' },
  { text: '标识', value: 'fitem_badge', sortable: true }
]

const items: Item[] = [
  {
    fitem_code: 'Stephen Curry',
    fitem_name: 'GSW',
    fvalue: 30,
    fitem_unit: 'G',
    fitem_ref: { height: '6-2', weight: 185 },
    fitem_badge: 'Davidson',
  },
]
</script>
